unit inputboxtopunit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TInputboxTop = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Label1: TLabel;
    Button2: TButton;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    dontselect: boolean;
    cpt,question,default: string;
  end;

var
  InputboxTop: TInputboxTop;

implementation

{$R *.dfm}

procedure TInputboxTop.FormShow(Sender: TObject);
begin
  caption:=cpt;
  Label1.Caption:=question;
  edit1.text:=default;
  edit1.SetFocus;

  if not dontselect then
  begin
    edit1.SelStart:=0;
    edit1.SelLength:=length(edit1.Text);
  end else
  begin
    edit1.SelStart:=length(edit1.Text);
    edit1.SelLength:=0;
  end;

  setwindowpos(Handle,HWND_TOPMOST,left,top,width,height,SWP_SHOWWINDOW);
end;

procedure TInputboxTop.Button1Click(Sender: TObject);
begin
  default:=edit1.Text;
  modalresult:=mrOk;
end;

end.
